import time


class Timer:
    def __init__(self,func):
        self.func = func

    def __call__(self, *args, **kwargs):
        time1 = time.perf_counter()
        result = self.func(*args, **kwargs)
        time2 = time.perf_counter()
        time3 = time2 - time1
        print(f"{self.func.__name__}函数总耗时{time3:.6f}s")
        return result

@Timer
def say_hello():
    print("hello")

say_hello()
